FROM mcr.microsoft.com/dotnet/sdk:latest AS build
WORKDIR /src
COPY ["IdentityService/IdentityService.WebAPI/IdentityService.WebAPI.csproj", "IdentityService/IdentityService.WebAPI/"]
RUN dotnet restore "IdentityService/IdentityService.WebAPI/IdentityService.WebAPI.csproj"
COPY . .
WORKDIR "/src/IdentityService/IdentityService.WebAPI"
RUN dotnet build "IdentityService.WebAPI.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "IdentityService.WebAPI.csproj" -c Release -o /app/publish

FROM mcr.microsoft.com/dotnet/aspnet:latest AS base
WORKDIR /app
COPY --from=publish /app/publish .
EXPOSE 80
EXPOSE 443
ENTRYPOINT ["dotnet", "IdentityService.WebAPI.dll"]